package com.scholarship.modules.backend.controller;

import com.scholarship.common.entity.RetCode;
import com.scholarship.common.entity.RetResponse;
import com.scholarship.common.entity.RetResult;
import com.scholarship.modules.backend.entity.AttributeType;
import com.scholarship.modules.backend.service.AttributeTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhz
 * @date 2021/3/23 20:04
 * 备注：创建基本属性类型
 */
@RestController
@Api(tags = {"创建基本属性类型"})
public class AttributeTypeController {
    @Autowired
    AttributeTypeService attributeTypeService;

    @ApiOperation("获取所有属性类型 @author zhz")
    @GetMapping("/admin/getAllAttribute")
    public RetResult listAttributeType(){
        return RetResponse.makeRsp(RetCode.SUCCESS,"成功获取所有属性类型",attributeTypeService.listAttributeType());
    }

    @ApiOperation("根据id获取属性类型 @author zhz")
    @GetMapping("/admin/getAttributeByID")
    public RetResult getAttributeByID(int id){
        return RetResponse.makeRsp(RetCode.SUCCESS,"成功获取属性类型",attributeTypeService.getAttributeTypeById(id));
    }
}

